Skip to content

feat(phase3-step10): Proactive Messaging + Auto-Escalation (backend)#22

Merged
AVADSA25 merged 11 commits intomainfrom
feat/phase3-step10-implementation
May 3, 2026
Merged

feat(phase3-step10): Proactive Messaging + Auto-Escalation (backend)#22
AVADSA25 merged 11 commits intomainfrom
feat/phase3-step10-implementation

Conversation

@AVADSA25
Copy link
Copy Markdown
Owner

@AVADSA25 AVADSA25 commented May 3, 2026

Summary

Phase 3 Step 10 — Proactive Messaging + Auto-Escalation. Backend complete. PWA HTML for Project-mode dropdown + status pills deferred to Phase 3.5 alongside the proactive intelligence overlay.

codec_agent_messaging.py ships agent → user message dispatch with 60s batching window. _run_agent (Step 9) gets post_message calls at 5 lifecycle points (started, checkpoint completed, blocked, aborted, done). Chat handler runs Qwen-3.6 classifier with 2-signal gate; on user "No", silences for that conversation (Q11).

Reference

  • Blueprint: docs/PHASE3-BLUEPRINT.md §4
  • TDD plan: docs/PHASE3-STEP10-PLAN.md
  • Resolved Q&A: Q9 PWA-only notifications · Q10 60s batching · Q11 session silence after No · Q12 proactive overlay → Phase 3.5

Files

Path Type Lines Purpose
codec_agent_messaging.py NEW ~270 AgentMessage, post_message, batching, silence, user replies
tests/test_agent_messaging.py NEW ~370 16 tests
tests/test_chat_escalation.py NEW ~130 8 tests
codec_audit.py MOD +12 Step 10 event constants + PHASE3_STEP10_EVENTS frozenset
codec_agent_runner.py MOD +42 post_message wired into 5 emit sites
routes/agents.py MOD +61 GET /messages, POST /messages, POST /silence
codec_dashboard.py MOD +125 Auto-escalation classifier + 2-signal gate
AGENTS.md MOD +63 Step 10 docs + Phase 3.5 deferrals

Audit envelope

3 new schema:1 events. agent_message_sent and _received thread the per-agent correlation_id from _run_agent's envelope. agent_auto_escalated_from_chat is independent (chat-handler invocation, no agent yet).

Permission/safety reuses

  • Step 1 audit envelope (paired correlation_ids)
  • Step 2 plugin lifecycle hooks
  • Step 3 ask_user (for clarifying questions in agent_question type)
  • Step 5 observer (passive recording)
  • Step 7 shift_report (agent activity surfaces in daily summary automatically)
  • Existing ~/.codec/notifications.json infrastructure since Phase 1

What's deferred to Phase 3.5

  • Project mode UIcodec_dashboard.html mode-dropdown + status pills polling /api/agents (backend supports it via POST /api/agents; UI is end-user polish)
  • Proactive intelligence overlay — Q12 was always Phase 3.5
  • Step 9 review C2 dedicated blocked_on_qwen status
  • Step 9 review M4 read-paths runtime enforcement

Test plan

  • 🧪 tests/test_agent_messaging.py → 16 passed
  • 🧪 tests/test_chat_escalation.py → 8 passed
  • 🧪 Full suite — 930 passed / 20 failed / 73 skipped (same 20/73 baseline as main, +25 new tests from Step 10)
  • All 3 Step 10 audit events emit with paired correlation_id where applicable
  • Auto-escalation 2-signal gate + Q11 session silence verified
  • Silence kill-switch tested (timeline preserved, banner skipped)
  • Post-merge deploy:
    cd ~/codec-repo
    git pull
    pm2 restart codec-dashboard codec-agent-runner
  • Real-world test: drop a project via POST /api/agents, approve, watch agent run + post update messages to chat thread

One subagent-flagged improvement

fix(agent_messaging): pass correct batched flag to audit emit — the original code hardcoded batched=False in the _audit call regardless of whether the message actually got batched into an existing banner. Now passes the correct flag.

Phase 3 closeout (next PR)

After this merges: docs/PHASE3-COMPLETE.md will consolidate all Step 8/9/10 sign-offs (matching Phase 1+2 closeout pattern). Phase 3.5 starts after.

🤖 Generated with Claude Code

@AVADSA25 AVADSA25 merged commit 82f837e into main May 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants